package com.dongdongshop.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongdongshop.mapper.TbAddressMapper;
import com.dongdongshop.pojo.AddressVO;
import com.dongdongshop.pojo.TbAddress;
import com.dongdongshop.service.AddRessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Description
 * @ClassName AddRessServiceImpl
 * @Author RC
 * @date 2020.12.22 17:48
 */
@Component
@Service
public class AddRessServiceImpl implements AddRessService {
    @Autowired
    private TbAddressMapper tbAddressMapper;
    @Override
    public List<AddressVO> getAddressInfo(String username) {
        return tbAddressMapper.getAddressInfoAll(username);
    }

    @Override
    public void saveAddRessInfo(TbAddress address) {
        tbAddressMapper.insertSelective(address);
    }

    @Override
    public void deleteInfo(Long id) {
        tbAddressMapper.deleteByPrimaryKey(id);
    }

    @Override
    public TbAddress getInfoById(Long id) {
        return tbAddressMapper.selectByPrimaryKey(id);
    }

    @Override
    public void updateAddRessInfo(TbAddress address) {
        tbAddressMapper.updateByPrimaryKeySelective(address);
    }
}
